<template>
  <div class="table-tree-wrapper" :class="{'search-tree-box': treeInSearch}" id="treeWrapper">
    <div class="tree-box">
      <header class="tree-search-header">
        <div class="form-group">
          <label class="sr-only" for>关键词</label>
          <div class="input-group">
            <input
              type="text"
              class="form-control"
              v-model="searchVal"
              id="searchNodeVal"
              placeholder="请输入搜索关键词"
              @keyup.enter="searchNodes"
              @input="inputSearchVal"
            />
            <a
              href="javascript:;"
              class="input-group-addon text-center"
              id="searchNodeBtn"
              @click.stop="searchNodes"
            >搜索</a>
          </div>
        </div>
      </header>
      <ul id="tableTree" class="ztree parkinglot-tree"></ul>
    </div>
  </div>
</template>

<script>
import common from "@mixins/common.js";
import tableTree from "@mixins/tables/tableTree.js";
export default {
  mixins: [common, tableTree],
  data() {
    return {};
  },
  mounted() {},
  methods: {}
};
</script>

<style lang="less">
@import "../../assets/less/base/variables.less";
@import "../../assets/less/libs/zTreeStyle.css";

.table-tree-wrapper {
  max-width: 300px;
  &.search-tree-box {
    padding-top: 0;
    margin-left: 0;
  }
}

.tree-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-right: @spacing * 2;
  .tree-search-header {
    width: 100%;
    padding: 12px;
    background-color: @lightGrey;
    border-bottom: 1px solid @greydd;
    .form-control {
      &:focus {
        border-color: lighten(@blue, 8%);
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075),
          0 0 8px rgba(85, 136, 221, 0.6);
      }
    }
    .input-group-addon {
      display: inline-block;
      height: 28px;
      line-height: 28px;
      padding-left: 8px;
      padding-right: 8px;
      border-radius: 4px;
      color: #fff;
      background-color: @blue;
      border-color: @blue;
    }
  }
  .input-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .form-control {
    flex: 1;
    display: inline-block;
    height: 30px;
    line-height: 30px;
    padding-left: 16px;
    padding-right: 16px;
    margin-right: 12px;
    border: 1px solid @lightBorderColor;
    border-radius: 4px;
  }
  .ztree {
    flex: 1;
    width: 100%;
    padding: @spacing * 2;
    max-height: 420px;
    overflow: auto;
    &.parkinglot-tree {
      li a span {
        font-size: 14px;
        font-family: "Helvetica Neue", Helvetica, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
      }
    }
    li {
      margin-bottom: 10px;
      &:last-child {
        margin-bottom: 0px;
      }
      ul {
        margin-top: 10px;
      }
      a {
        &:hover {
          background: none;
          border: 0;
          text-decoration: none;
          color: @blue;
        }
        span {
          vertical-align: sub;
        }
      }
      span {
        &.checkbox_false_disable + a {
          color: #888888;
        }
      }
    }
  }
  .tree-footer {
    width: 100%;
    text-align: center;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid @greydd;
  }
}
</style>
